package com.example.appmanager.ui.update;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.appmanager.R;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.RecyclerView;

/*
这个是修改信息的Fragment
* */
public class updateFragment extends Fragment {

    private updateViewModel homeViewModel;
    private RecyclerView recyclerView;


    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        homeViewModel = ViewModelProviders.of(this).get(updateViewModel.class);
        View root = inflater.inflate(R.layout.fragment_update_user, container, false);
        final TextView textView = root.findViewById(R.id.text_update);
        homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
            @Override
            public void onChanged(@Nullable String s) {
                textView.setText(s);
            }
        });


        initUi(root);/*初始化页面的控件*/

        setData();//设置监听

        return root;
    }

    /*初始化页面的控件*/
    private void initUi(View root) {
        recyclerView = root.findViewById(R.id.update_userinfo_recycle);
    }

    private void setData() {

    }
}
